/******************************************************************************* 
 *  Copyright 2007 Amazon Technologies, Inc.  
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  
 *  You may not use this file except in compliance with the License. 
 *  You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
 *  This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
 *  CONDITIONS OF ANY KIND, either express or implied. See the License for the 
 *  specific language governing permissions and limitations under the License.
 * ***************************************************************************** 
 *    __  _    _  ___ 
 *   (  )( \/\/ )/ __)
 *   /__\ \    / \__ \
 *  (_)(_) \/\/  (___/
 * 
 *  Amazon ECS CSharp Library
 *  API Version: 2007-07-16
 *  Generated: Thu Aug 02 10:15:38 PDT 2007 
 * 
 */

using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Text;


namespace Amazon.ECS.Model
{
    [XmlTypeAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16")]
    [XmlRootAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16", IsNullable = false)]
    public class VariationSummary
    {
    
        private  Price lowestPriceField;
        private  Price highestPriceField;
        private  Price lowestSalePriceField;
        private  Price highestSalePriceField;
        private String singleMerchantIdField;


        /// <summary>
        /// Gets and sets the LowestPrice property.
        /// </summary>
        [XmlElementAttribute(ElementName = "LowestPrice")]
        public Price LowestPrice
        {
            get { return this.lowestPriceField ; }
            set { this.lowestPriceField = value; }
        }



        /// <summary>
        /// Sets the LowestPrice property
        /// </summary>
        /// <param name="lowestPrice">LowestPrice property</param>
        /// <returns>this instance</returns>
        public VariationSummary WithLowestPrice(Price lowestPrice)
        {
            this.lowestPriceField = lowestPrice;
            return this;
        }



        /// <summary>
        /// Checks if LowestPrice property is set
        /// </summary>
        /// <returns>true if LowestPrice property is set</returns>
        public Boolean IsSetLowestPrice()
        {
            return this.lowestPriceField != null;
        }




        /// <summary>
        /// Gets and sets the HighestPrice property.
        /// </summary>
        [XmlElementAttribute(ElementName = "HighestPrice")]
        public Price HighestPrice
        {
            get { return this.highestPriceField ; }
            set { this.highestPriceField = value; }
        }



        /// <summary>
        /// Sets the HighestPrice property
        /// </summary>
        /// <param name="highestPrice">HighestPrice property</param>
        /// <returns>this instance</returns>
        public VariationSummary WithHighestPrice(Price highestPrice)
        {
            this.highestPriceField = highestPrice;
            return this;
        }



        /// <summary>
        /// Checks if HighestPrice property is set
        /// </summary>
        /// <returns>true if HighestPrice property is set</returns>
        public Boolean IsSetHighestPrice()
        {
            return this.highestPriceField != null;
        }




        /// <summary>
        /// Gets and sets the LowestSalePrice property.
        /// </summary>
        [XmlElementAttribute(ElementName = "LowestSalePrice")]
        public Price LowestSalePrice
        {
            get { return this.lowestSalePriceField ; }
            set { this.lowestSalePriceField = value; }
        }



        /// <summary>
        /// Sets the LowestSalePrice property
        /// </summary>
        /// <param name="lowestSalePrice">LowestSalePrice property</param>
        /// <returns>this instance</returns>
        public VariationSummary WithLowestSalePrice(Price lowestSalePrice)
        {
            this.lowestSalePriceField = lowestSalePrice;
            return this;
        }



        /// <summary>
        /// Checks if LowestSalePrice property is set
        /// </summary>
        /// <returns>true if LowestSalePrice property is set</returns>
        public Boolean IsSetLowestSalePrice()
        {
            return this.lowestSalePriceField != null;
        }




        /// <summary>
        /// Gets and sets the HighestSalePrice property.
        /// </summary>
        [XmlElementAttribute(ElementName = "HighestSalePrice")]
        public Price HighestSalePrice
        {
            get { return this.highestSalePriceField ; }
            set { this.highestSalePriceField = value; }
        }



        /// <summary>
        /// Sets the HighestSalePrice property
        /// </summary>
        /// <param name="highestSalePrice">HighestSalePrice property</param>
        /// <returns>this instance</returns>
        public VariationSummary WithHighestSalePrice(Price highestSalePrice)
        {
            this.highestSalePriceField = highestSalePrice;
            return this;
        }



        /// <summary>
        /// Checks if HighestSalePrice property is set
        /// </summary>
        /// <returns>true if HighestSalePrice property is set</returns>
        public Boolean IsSetHighestSalePrice()
        {
            return this.highestSalePriceField != null;
        }




        /// <summary>
        /// Gets and sets the SingleMerchantId property.
        /// </summary>
        [XmlElementAttribute(ElementName = "SingleMerchantId")]
        public String SingleMerchantId
        {
            get { return this.singleMerchantIdField ; }
            set { this.singleMerchantIdField= value; }
        }



        /// <summary>
        /// Sets the SingleMerchantId property
        /// </summary>
        /// <param name="singleMerchantId">SingleMerchantId property</param>
        /// <returns>this instance</returns>
        public VariationSummary WithSingleMerchantId(String singleMerchantId)
        {
            this.singleMerchantIdField = singleMerchantId;
            return this;
        }



        /// <summary>
        /// Checks if SingleMerchantId property is set
        /// </summary>
        /// <returns>true if SingleMerchantId property is set</returns>
        public Boolean IsSetSingleMerchantId()
        {
            return  this.singleMerchantIdField != null;

        }




        /// <summary>
        /// XML fragment representation of this object
        /// </summary>
        /// <returns>XML fragment for this object.</returns>
        /// <remarks>
        /// Name for outer tag expected to be set by calling method. 
        /// This fragment returns inner properties representation only
        /// </remarks>


        protected internal String ToXMLFragment() {
            StringBuilder xml = new StringBuilder();
            if (IsSetLowestPrice()) {
                Price  lowestPrice = this.LowestPrice;
                xml.Append("<LowestPrice>");
                xml.Append(lowestPrice.ToXMLFragment());
                xml.Append("</LowestPrice>");
            } 
            if (IsSetHighestPrice()) {
                Price  highestPrice = this.HighestPrice;
                xml.Append("<HighestPrice>");
                xml.Append(highestPrice.ToXMLFragment());
                xml.Append("</HighestPrice>");
            } 
            if (IsSetLowestSalePrice()) {
                Price  lowestSalePrice = this.LowestSalePrice;
                xml.Append("<LowestSalePrice>");
                xml.Append(lowestSalePrice.ToXMLFragment());
                xml.Append("</LowestSalePrice>");
            } 
            if (IsSetHighestSalePrice()) {
                Price  highestSalePrice = this.HighestSalePrice;
                xml.Append("<HighestSalePrice>");
                xml.Append(highestSalePrice.ToXMLFragment());
                xml.Append("</HighestSalePrice>");
            } 
            if (IsSetSingleMerchantId()) {
                xml.Append("<SingleMerchantId>");
                xml.Append(EscapeXML(this.SingleMerchantId));
                xml.Append("</SingleMerchantId>");
            }
            return xml.ToString();
        }

        /**
         * 
         * Escape XML special characters
         */
        private String EscapeXML(String str) {
            StringBuilder sb = new StringBuilder();
            foreach (Char c in str)
            {
                switch (c) {
                case '&':
                    sb.Append("&amp;");
                    break;
                case '<':
                    sb.Append("&lt;");
                    break;
                case '>':
                    sb.Append("&gt;");
                    break;
                case '\'':
                    sb.Append("&#039;");
                    break;
                case '"':
                    sb.Append("&quot;");
                    break;
                default:
                    sb.Append(c);
                    break;
                }
            }
            return sb.ToString();
        }




    }

}